function class(classname, ...)
    local cls = { __cname = classname, }

    local __super = {}
    local __index = function(_, key)
        if cls[key] then return cls[key] end
        for _, x in ipairs(__super) do
            if x[key] then return x[key] end
        end
    end

    cls.inherit = function(_, ...)
        for i = 1, select("#", ...) do
            local x = select(i, ...)
            if type(x) == "table" then
                table.insert(__super, x)
            end
        end
    end

    cls.create = function(...)
        local instance = {}
        setmetatable(instance, { __index = __index, })
        return instance
    end

    return cls
end
